package com.haoshuang.zhouzhoubang.ui.page.mine.contract.fragment

import com.haoshuang.zhouzhoubang.model.api.ApiRepo
import com.haoshuang.zhouzhoubang.model.bean.MyContractBean
import com.mufeng.libs.base.BaseViewModel
import com.mufeng.libs.net.netRequest
import com.mufeng.libs.state.StateData
import com.mufeng.libs.state.StatefulMutableLiveData

class MyContractChildViewModel : BaseViewModel() {

    /**
     * 我的合同列表
     */
    val getTeamContractListData = StatefulMutableLiveData<MutableList<MyContractBean>>()
    fun getTeamContractList(status: Int, page: Int) = netRequest {
        start { getTeamContractListData.value = StateData.Loading }
        request { ApiRepo.getTeamContractList(status, page)  }
        success { getTeamContractListData.value = StateData.Success(it.data) }
        error { code, msg ->
            getTeamContractListData.value = StateData.Error(code, msg)
        }
    }

}